{% extends "layout.html" %}

{% block body %}

<p>
	<a href="/Task/Clean/{{ task.id }}"><button class="btn btn-danger">Clean task data</button></a>
	<a href="/Task/listall"><button class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> Back to tasks list</button></a>
</p>

{% if task.taskstate=="Error" or task.taskstate=="Running" %}
<div class="alert alert-danger" >
	<p>This taks has errors. Check the error messages below, fix these errors, go back to your project and restart your task.</p>
</div>
{% endif %}

<table class="table table-condensed">
<tr>
    <th>Task ID</th><td>{{ task.id }}</td>
</tr><tr>
    <th width="150px">Class</th><td>{{ task.taskclass }}</td>
</tr><tr>
    <th width="150px">Owner</th><td>{{ task.owner_rel }}</td>
</tr><tr>
    <th>State</th><td>{{ task.taskstate }}
    {% if task.taskstate=="Question" %}
        <a href="/Task/Question/{{ task.id }}"><span class="label label-warning">Go</span></a>
    {% endif %}
    {% if task.taskstate=="Error" or task.taskstate=="Running" %}
        <a href="/Task/ForceRestart/{{ task.id }}"><button class="btn btn-danger btn-sm">Force restart</button></a>
    {% endif %}

</td>
</tr><tr>
    <th>Step</th><td>{{ task.taskstep }}</td>
</tr><tr>
    <th>Progress</th><td>{{ task.progresspct }}%</td>
</tr><tr>
    <th>Message</th><td>{{ task.progressmsg }}
    <ul>
    {% for e in steperror  %}
        <li>{{ e }}</li>
    {% endfor %}
		</ul>
</td>
</tr><tr class="collapse">
    <th>Input Param</th><td>{{ task.inputparam }}</td>
</tr>
</tr><tr class="collapse">
    <th>Question Data</th><td>{{ task.questiondata }}</td>
</tr>
</tr><tr class="collapse">
    <th>Answer Data</th><td>{{ task.answerdata }}</td>
</tr>
</table>

<p><a class="btn" data-toggle="collapse" data-target=".collapse">View internal details &raquo;</a></p>

<p><a class="btn" href="?log=Y">View log file &raquo;</a></p>

{% if CustomDetailsAvail %}<p><a class="btn" href="?CustomDetails=Y">View custom details &raquo;</a></p>{% endif %}

<p>{{ extratext|safe }}</p>

{% endblock %}

